<?php
date_default_timezone_set('Asia/Tokyo');

/**
 * This class includes the configurations for a database you use.<br/>
 * The configurations are host name (or IP address) of the database, user name, password, database name,
 * character encoding for the database.<br/>
 * You have to modify this class for making the configuration suitable for the database you use.<br/>
 * 
 * @package lib.famteam.phporm
 * @author polikeiji
 */
class DatabaseConfiguration {
	const TABLE_NAME_PREFIX = "";

	const DATABASE_HOST = 'localhost';
	const DATABASE_NAME = '';
	const DATABASE_USER = '';
	const DATABASE_PASSWORD = '';
	const DATABASE_ENCODING = '';

	/**
	 * Return the table's name for a class of the object passed as the parameter.<br/>
	 * In default, the table name is (DatabaseConfiruration::TABLE_NAME_PREFIX + the class name).<br/>
	 * If you want to change the naming convention for table names, you can modify this method.<br/>
	 * 
	 * @param object $object
	 * @return str table name
	 */
	public static function getTableName($object) {
		return DatabaseConfiguration::TABLE_NAME_PREFIX . get_class($object);
	}
	
	/**
	 * 
	 * @param str $tableName
	 * @return str
	 */
	public static function getClassName($tableName) {
		return substr($tableName, strlen(DatabaseConfiguration::TABLE_NAME_PREFIX), strlen($tableName));
	}
}
?>
